<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix = "s" uri ="/struts-tags" %>
<%@ taglib uri="/struts-dojo-tags" prefix="sx"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<sx:head parseContent="true"/>

	<script type="text/javascript" src="addSecondId/jquery-1.7.2.js"></script>
	<script type="text/javascript">
  		$(document).ready(function(){
			init();
			$("#taxAllInfoList").click(function(){getZyClass();});
			$("#zyClassList").click(function(){getZyFirst();});	
			$("#zyFirstList").click(function(){getZySecond();});	
			$("#zySecondList").click(function(){getZy();});				
			
			
		});
		//总分类
		function init(){
			$("#taxAllInfo").empty();
			$.ajax({
				url:"taxAllInfo!showTaxAllInfoAdd",
				type:"POST",
				success:function(result,status){
					//alert(status);
					var objs = eval("("+result+")");
					 $.each(objs,function(index,item){
					 		$("<option></option>")
								.val(item["infoId"])
								.text(item["infoName"])
								.appendTo($("#taxAllInfoList"));
					 });  
					
				}
			});
		};
		
		//分类
		function getZyClass(){
			$("#zyClassList").empty();
			$.ajax({
				url:"zyClass!showZyClassByPidAdd?pid="+$("#taxAllInfoList").val(),
				type:"POST",
				success:function(result,status){
					var objs = eval("("+result+")");				
					 $.each(objs,function(index,item){ 
					 		$("<option></option>")
								.val(item["classId"])
								.text(item["className"])
								.appendTo($("#zyClassList"));
					 });  					
				}
			});
		};
		
		//查询一级分类
		function getZyFirst(){			
			$("#zyFirstList").empty();
			$.ajax({
				url:"zyFirst!showZyFirstByPidAdd?pid="+$("#zyClassList").val(),
				type:"POST",
				success:function(result,status){
					var objs = eval("("+result+")");
					 $.each(objs,function(index,item){ 					
					 			$("<option></option>")
								.val(item["firstId"])
								.text(item["firstName"])
								.appendTo($("#zyFirstList"));
					 }); 
					 
					  					
				}
			});
		};
		
		//查询二级分类
		function getZySecond(){
			$("#zySecondList").empty();
			$("#fileAllInfoTage").val($("#zyFirstList").val());//设置隐藏的firstId值
			$.ajax({
				url:"zySecond!showZySecondByPidAdd",
				type:"POST",
				data:{firstId:$("#zyFirstList").val()},
				success:function(result,status){
					var objs = eval("("+result+")");
				
						 $.each(objs,function(index,item){      
					 		$("<option></option>")
								.val(item["secondId"])
								.text(item["secondName"])
								.appendTo($("#zySecondList"));
					/*		$("<input type='checkbox' name='fileSecondTag' id='fileSecondTag'></input>")
								.val(item["secondId"])
								.appendTo($("#secondList"));
							$("<label for='zySecond'></label>")
								.html(item["secondName"])
								.appendTo($("#secondList"));
							if(index%5==0){
								$("#secondList").append("<br/>");
							}
					*/		
					 });  					
				}
			});
		};
		function setFirstId(){//设置隐藏的FirstId
			$("fileAllInfoTage").val($("#zyFirstList"));
		}
</script>	
</head>
  <body>
  	
	<form action="taxFile!addTaxFile" method="post">
  	
  <table>
      <tr>
      		<th>总信息</th>
			<th>总分类</th>
			<th>一级</th>
			<th>二级</th>
      </tr>	  
     
      <tr>
          <td>
              <select id="taxAllInfoList"  style="width:110px;" ></select>
          </td>
          <td>
              <select id="zyClassList" style="width:110px;"></select>
          </td>
          <td>
              <select id="zyFirstList" style="width:110px;"></select>
          </td>
          <td>
              <select id="zySecondList" style="width:110px;"></select>
          </td>
      </tr>
  </table>
  <div id="secondList"></div>
  <!--
  <table>
  	<tr>
  		<td>
  			<input type="checkbox" id="zySecond"></input>
  		</td>
  	</tr>
	
  </table>
--->

 <table border="1">
		<tr>
			<td>
				<center>
					增加文档
				</center>
			</td>
		</tr> 	
 		<tr>
 			<td>标题*：<input type="text" name="fileTitle"/></td>
 		</tr>
 		<tr>
 			<td>文件号：<input type="text" name="fileNo"/></td>
 		</tr>
 		<tr>
 			<td>发布时间*：<sx:datetimepicker value="today" name="fileDate" ></sx:datetimepicker></td>
 		</tr>
 		<!--<tr>
 			<td>总分类标签：<input type="text" name="fileAllInfoTage"><input></td>
 		</tr>-->
 		 <!--<tr>
 			<td>二级分类标签*： <br>
 			
 			</td>
 		</tr>-->
 		<tr>
 			<td>内容*：<br><textarea cols="80" rows="10"  name="fileContent"></textarea></td>
 		</tr>
 		<tr>
 			<td>状态*：<s:radio value="'有效法规'" theme="simple" list="{'有效法规','失效法规','部分失效','全文过时','基本法规'}" name="fileStatus"/></td>
 		
 			<!--<td>状态*：<input type="radio"  name="fileStatus"/></td>-->
		<!--	value="'有效法规'"  list="{'有效法规','失效法规','部分失效','全文过时','基本法规'}"-->
 		</tr>
 		<tr>
 			<td>备注：<textarea  name="fileInfo"cols="80" rows="4"></textarea></td>
 		</tr>
 		<tr>
 			<td>参考文件：<textarea  name="fileReference"cols="80" rows="4"></textarea></td>
 		</tr>
 		<tr>
 			<td>
 			<s:property value='#parameters.secondId'/>
 			<!-- 	<s:hidden name="fileSecondTag" value="%{#parameters.secondId}"/> -->
 				<!--<s:hidden id="fileAllInfoTage" name="fileAllInfoTage"/>-->
				<input type="submit"/>
 			</td>
 		</tr>
    	
    </table>
   </form>
    
  </body>
</html>
